#ifndef DOMAINQUERYTASK_H
#define DOMAINQUERYTASK_H

//#include <QObject>
//#include <QRunnable>
#include "precomp.h"
#include "publicstruct.h"
//#include <QAtomicInt>
class DomainQueryTask : public QObject, public QRunnable
{
    Q_OBJECT
public:
    explicit DomainQueryTask(QAtomicInt &finishedTasks,const SocketDnInfo &sdni, QObject *parent = nullptr);

    ~DomainQueryTask() override;

    void run() override;
public slots:
    void stopTask();
signals:
    void validationResult(QByteArray data,QString reqParam);
    void exitTask();
private:
    QString m_proxyHost,m_proxyaddr;
    QString m_host;
    int m_port,m_proxyPort;
    SocketDnInfo m_sdni;
    QByteArray m_recvBuffer;
    QString m_reqParam;
    QAtomicInt &m_finishedTasks;
    //QTcpSocket *m_tcpSocket;
public slots:
    void socketError(QAbstractSocket::SocketError error);
    void handleDataReceived();
    void sendMessage();
};

#endif // DOMAINQUERYTASK_H
